<?php

namespace app\common\model;

//use think\Model;

class AssistModel extends BaseModel {

	protected $table = 'tp_assist';

	/*
	添加记录
	*/
	public function addData($uid,$title,$content,$pic,$type){
		$data = [
			'uid'=>$uid,
			'title'=>$title,
			'type'=>$type,
			'content'=>$content,
			'pic'=>$pic,
			'date'=>$this->getdate()
		];
		$res = $this->insert($data);
		return $res;
	}

	/*
	获取列表
	 */
	public function getAssistList($uid) {
		$data = $this->where('uid', $uid)->order('id desc')->select();
		return $data;
	}

	/*
	获取详情
	 */
	public function getDetail($uid,$id){
		$data = $this->where('uid',$uid)->where('id',$id)->find();
		return $data;
	}
}
